public class Animal {
    static int a = 100;

    public static void main(String[] args) {
        cat cat = new Animal().new cat();
    }

    //静态成员内部类
    public static class dog{
        private String name;
        private int age;

        public dog() {
        }

        public String getName() {
            System.out.println(a);//可以访问静态成员变量
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }


    //成员内部类
    public class cat{
        private String name;
        private int age;
        public static int bbb;//JDK16 开始支持静态成员

        public cat() {
        }

        public cat(String name, int age) {
            this.name = name;
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }
}
